function echo<T>(arg:T):T{
    return arg
}
const result = echo('wangyang')

function swap<T,U>(tuple:[T,U]):[U,T]{
    return [tuple[1],tuple[0]]
}
const  result1 = swap(['string',123])

console.log(result1[0]);


function echoWithArr<T>(arg:T[]):T[]{
    console.log(arg.length);
    return arg
}

const arrs = echoWithArr([1,2,3])


interface IWithLength{
    length:number
}

function echoWithLength<T extends IWithLength>(arg:T):T{
    console.log(arg.length);
    return  arg
}

const str1 = echoWithLength('str');

const obj = echoWithLength({length:10,with:10})

const arr1 = echoWithLength([1,3,4])



class Queue<T>{
    private data = [];
    push(item:T){
        return this.data.push(item)
    }
    pop():T{
        return this.data.shift()
    }
}

const  queue = new Queue<number>()
queue.push(1)

console.log(queue.pop().toFixed());


interface KeyPair<T,U>{
    key: T,
    value: U,
}

let kp1 : KeyPair<number, string> = {key:1,value:'string'}
let kp2: KeyPair<string, number> = {key: 'str',value: 2}

let arr : number[] = [1,2,3]

let arrTwo: Array<number> = [1,2,3]



